import router from "@/router/router.js";
import store from "./store/store.js"

router.beforeEach((to, from, next) => {
  if (to.path == '/')
    return next('/home')
  // 如果store中有userID,路由继续
  // 监听路由变化，阻止首页后退
  // 这段代码用于解决组件的后退问题
  // 判断组件面包屑导航breadcrumbComp有无数据
  if (store.state.breadcrumbComp.length) {
    // 记录后退动作
    store.commit("SET_ISRETURN");
    // 阻止跳转
    return next(false);
  }
  next()
});
router.afterEach(() => { });
